﻿Public Class frmThemPhimMoi 

    Private Sub frmThemPhimMoi_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        cmbTheLoai.DataSource = TheLoaiBUS.loadTheLoai()
        cmbTheLoai.DisplayMember = "TenTheLoai"
        cmbTheLoai.ValueMember = "MaTheLoai"
    End Sub

    Private Sub bntNhapPhim_Click(sender As System.Object, e As System.EventArgs) Handles bntNhapPhim.Click
        ThemPhim()

    End Sub

#Region "Hàm Xử Lí"
    Sub ThemPhim()
        Dim phim As New PhimDTO
        Dim thl As New TheLoaiDTO
        thl.maTheLoai = cmbTheLoai.SelectedValue
        thl.tenTheLoai = cmbTheLoai.Text
        thl.soLuongPhim = TheLoaiBUS.soLuongTL(thl)
        phim.maPhim = cmbTheLoai.SelectedValue + thl.soLuongPhim.ToString()
        'MessageBox.Show(phim.maPhim)
        phim.maTheLoai = cmbTheLoai.SelectedValue
        phim.tenPhim = txtTenPhim.Text
        phim.tomTat = rtxtThongTin.Text
        TheLoaiBUS.updateTheLoai(thl)
        PhimBUS.themPhim(phim)
        frmAdminForm.LoadTaiKhoan()
        ' MessageBox.Show(phim.tomTat)
    End Sub
#End Region
End Class